<!doctype html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>Master AI率检测 - 确认订单</title>
    <link rel="shortcut icon" href="../pc/assets/favicon.ico" type="image/vnd.microsoft.icon" />
    <!-- Bootstrap -->
    <link rel="stylesheet" href="../pc/assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="../pc/assets/css/common.css?v=2.2">
    <link rel="stylesheet" href="../pc/assets/css/pay.css?v=1.6">
    <!-- <link rel="stylesheet" href="../assets/css/styles.css" /> -->
    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!--[if lt IE 9]>
    <script src="https://fastly.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
    <script src="https://fastly.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->
    <script>
        var USER_TOKEN = 'RmlETkdPdjYzZmVjNTVhMDAyYzY=' // 线上
        var JANE_NAME = 'aigc_check';
    </script>
</head>

<body>
<div class="head-nav">
    <div class="container">
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">切换导航</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="./index.html">
                        <img src="../pc/assets/img/logo.png" alt="logo">
                    </a>
                    <div class="logoTips" style="float: left;">
                        <p>用AI语言模型检测AIGC</p>
                        <p>实现快速、准确识别学术文本中的AI生成内容</p>
                    </div>
                </div>

                <div class="collapse navbar-collapse topNav" id="bs-example-navbar-collapse-1">
                    <a class="Sample" target="_blank" href="./demo/aigc_check/%E5%95%86%E4%B8%9A%E9%93%B6%E8%A1%8C%E8%B4%A2%E5%AF%8C%E7%AE%A1%E7%90%86%E4%B8%9A%E5%8A%A1%E5%8F%91%E5%B1%95-AIGC%E6%A3%80%E6%B5%8B%E6%8A%A5%E5%91%8A.html?v1" target="_blank" rel="noopener noreferrer">AIGC报告样例</a>
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="index.html">提交检测</a></li>
                        <li><a href="query.html">下载报告</a></li>
                    </ul>
                </div>
            </div>
        </nav>
    </div>
</div>

<div class="container mainDiv">
    <div class="leftDiv">
        <div class="ContentMain">
            <div class="check-order">
                <div class="head">
                    <img src="../pc/assets/img/order.png" alt="">
                    <span class="label-t">核对订单</span>
                    <span class="order-text">订单编号：</span>
                    <span class="order-oid"></span>
                </div>
                <div class="order-info">
                    <table class="orderInformation table" border="0" cellspacing="0">
                        <thead>
                        <tr>
                            <th width="" class="title">题目</th>
                            <th width="120" class="center">作者</th>
                            <th width="160" class="center">送检字符数</th>
                            <th width="200" class="center">计费规则</th>
                            <th width="140" class="center">计费金额</th>
                        </tr>
                        </thead>
                        <tbody class="tbody">
                        <th class="title order-title"></th>
                        <th class="center order-author"></th>
                        <th class="center order-wordNum"></th>
                        <th class="center order-unitPrice">获取中</th>
                        <th class="center redText order-totalPrice"></th>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="payBox">
                <div class="coupon-block">
                    <div class="head">
                        <img src="../pc/assets/img/coupon.png" alt="">
                        <span class="label-t">优惠券</span>
                    </div>
                    <div class="form-group form-group_s card">
                        <input autocomplete="off" class="form-control" onKeyUp="value=value.replace(/[\W]/g,'')" maxlength="30" name="coupon" type="text" placeholder="请输入优惠券码" id="coupon"/>
                        <span class="use_now">兑换</span>
                        <span class="errorTip"><img src="../pc/assets/img/err_tip.png" alt=""><span></span></span>
                    </div>
                </div>
                <div class="pay-block">
                    <div class="head">
                        <img src="../pc/assets/img/pay.png" alt="">
                        <span class="label-t">支付方式</span>
                    </div>
                    <div class="clearfix2">
                        <div class="payType pull-left">
                            <div id="alipay" data-type="alipayScan" style="display: none;">
                                <img src="../pc/assets/img/Alipay.png" alt="">
                                <span>支付宝支付</span>
                            </div>
                            <div id="wx" data-type="wxScan" style="display: none;">
                                <img src="../pc/assets/img/wx.png" alt="">
                                <span>微信支付</span>
                            </div>
                            <div id="scanCodeRich" data-type="scanCodeRich" style="display: none;">
                                <img src="../pc/assets/img/scanpay.png" alt="">
                                <span>扫码支付</span>
                            </div>
                            <div id="thirdparty" data-type="thirdparty" style="display: none;">
                                <img src="../pc/assets/img/dsf.png" alt="">
                                <span>第三方支付</span>
                            </div>
                        </div>
                        <div class="code pull-left">
                            <div class="pull-left codeER">
                                <div id="qrcode"></div>
                                <div class="load">
                                    <img src="../pc/assets/img/loding.gif" alt="">
                                </div>
                                <div class="mask">
                                    <img src="../pc/assets/img/expired.png" alt="">
                                    <p>点击刷新</p>
                                </div>
                                <p class="tips">提示：扫码支付,请勿刷新页面</p>
                            </div>
                            <div class="pull-left titlesRight payTypeClass">
                                <div class="payTypes">单价: <span class="UnitPrice">暂无</span> </div>

                                <div class="amount">应付金额 <span><b>￥</b><span class="orderAmount">00.00</span></span></div>

                                <p class="auxiliary">剩余支付时间 <span class="time"><span class="payTime">--</span>秒</span>，<span class="next">已支付下一步</span></p>

                                <div class="tipsBox">
                                    <div class="typeTips">
                                        <img src="../pc/assets/img/wx.png" alt="">
                                        <img src="../pc/assets/img/Alipay.png" alt="">
                                        <!--                                    <img src="../assets/img/ysf.png" alt="">-->
                                        <span>使用微信、支付宝扫码支付 </span>
                                        <!--                                    <span>使用微信扫码支付 </span>-->
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tbPay pull-left">
                            <div class="Options">
                                <div id="XHS" class="zdyType" data-type="redBook">
                                    <img src="../pc/assets/img/xhs.png" alt="">
                                    小红书订单
                                </div>
                                <div id="TB" class="zdyType" data-type="taobao">
                                    <img src="../pc/assets/img/tb.png" alt="">
                                    淘宝订单
                                </div>
                            </div>

                            <div class="main">
                                <div class="tb-content">
                                    <div class="tb-idBox">
                                        <label>订单编号：</label>
                                        <input
                                                autocomplete="off" maxlength="30" name="NumberWords"
                                                type="text"
                                                placeholder="填写淘宝订单编号(必填)"
                                                id="tbTid"
                                                class="form-control tb-oid noMarginTop" />

                                        <span class="tipsDiv2">
                                        <img src="../pc/assets/img/tipsText.png" alt="">
                                        <div>
                                            不满一件, 按一件计算
                                        </div>
                                    </span>
                                    </div>
                                    <div class="tb-idBox">
                                        <label>备用订单：</label>
                                        <!-- onafterpaste="this.value=this.value.replace(/[^\d]/g,'') "
                                        onkeyup="this.value=this.value.replace(/[^\d]/g,'') "
                                         -->
                                        <input
                                                autocomplete="off" maxlength="60" name="NumberWords"
                                                type="text"
                                                placeholder="数额不足时填写，会合并数额"
                                                id="tbTid-2"
                                                class="form-control tb-oid" />
                                        <span class="tipsDiv">
                                            <img src="../pc/assets/img/tipsText2.png" alt="">
                                            <div>
                                                多个备用订单
                                                <br>
                                                请用英文逗号分隔
                                            </div>
                                        </span>
                                    </div>
                                    <div class="errTip"></div>
                                    <div class="tb-payOrder">立即使用</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="rightDiv">
        <div class="Reason">
            <div class="ReasonAsk">为什么选择<span class="Blue">AI率检测？</span></div>
            <div class="ReasonMain">
                <div class="row Strength">
                    <div class="col-sm-6 card1">
                        <img class="StrengthImg" src="../pc/assets/img/EfficientDetection.png" alt="">
                        <div class="StrengthText">
                            <b>高效检测</b>
                            <p>采用先进检测技术</p>
                            <p>拥有高效检测能力</p>
                        </div>
                    </div>
                    <div class="col-sm-6 card2">
                        <img class="StrengthImg" src="../pc/assets/img/varietyFormats.png" alt="">
                        <div class="StrengthText">
                            <b>类型多样</b>
                            <p>支持期刊/学位/</p>
                            <p>课程论文等检测</p>
                        </div>
                    </div>
                    <div class="col-sm-6 card3">
                        <img class="StrengthImg" src="../pc/assets/img/RichInLevels.png" alt="">
                        <div class="StrengthText">
                            <b>层次丰富</b>
                            <p>详细的可视化报告</p>
                            <p>轻松识别AIGC问题</p>
                        </div>
                    </div>
                    <div class="col-sm-6 card4">
                        <img class="StrengthImg" src="../pc/assets/img/Safety.png" alt="">
                        <div class="StrengthText">
                            <b>安全可靠</b>
                            <p>采用先进加密技术</p>
                            <p>确保隐私不被泄露</p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="Declare">
                《中华人民共和国学位法 (草案) 》第六章第三十三条明确：在获得该学位过程中如有人工智能代写等学术不端行为，经学位评定委员会审议决定，可由学位授予单位撤销学位证书。
            </div>
        </div>
        <div class="problem">
            <div class="tabHader row">
                <div class="commonProblem col-sm-6 Select" ContentKey="commonProblemBox">
                    <img class="img1" src="../pc/assets/img/commonProblem1.png" alt="">
                    <img class="img2" src="../pc/assets/img/commonProblem2.png" alt="">
                    常见问题
                </div>
                <i class="link"></i>
                <div class="MustRead col-sm-6" ContentKey="MustReadBox">
                    <img class="img1" src="../pc/assets/img/BeCareful1.png" alt="">
                    <img class="img2" src="../pc/assets/img/BeCareful2.png" alt="">
                    上传必读
                </div>
            </div>
            <div class="problemBox">
                <div class="commonProblemBox Select">
                    <div class="problem1">
                        <b>
                            AIGC检测服务是什么
                        </b>
                        <p>
                            AIGC检测服务可以区分人工编写的内容和AI模型生成的文本。 系统将快速生成报告，识别文本AIGC值的高低。AIGC检测服务目前作为辅助工具，仅提示文本内容可能由AI生成。
                        </p>
                    </div>
                    <div class="problem2">
                        <b>
                            AIGC检测结果说明
                        </b>
                        <p>
                            检测结果由系统自动生成，为您提供的是相关线索而非判断依据和（或者）判断标准，仅供参考。
                        </p>
                        <p>
                            1）AIGC值与论文质量无关，仅表示论文中内容片段存在AI生成可能性的概率。
                        </p>
                        <p>
                            2）检测结果代表论文是否疑似AI生成，仅供参考。
                        </p>
                        <p>
                            3）由于AI模型的差异性，检测结果可能存在误差。
                        </p>
                    </div>
                </div>
                <div class="MustReadBox">
                    <p>当前版本<span>仅支持中文内容</span>检测，英文数字等非中文内容自动忽略</p>
                    <p>支持上传<span> doc、docx、txt</span>格式，文本不超过100万字符</p>
                    <p>文件大小<span>不超过 30M</span>，若超过30M导致上传失败，建议您删除送检文献中图片、图表、表格后，再进行上传</p>
                    <p><span>为了不影响检测结果，</span>让系统准确识别参考文献，请在正文后标明<span>“参考文献”</span>字样，并在之后按照《信息与文献参考文献著录规则》(GBIT7714-2015)规范参考文献格式</p>
                    <p>使用doc、docx文档查重时，系统无法识别<span>脚注、尾注</span>，请知悉</p>
                    <p><span>修订、批注</span>模式会导致报告内容缺失，请核查后上传</p>
                </div>
            </div>
        </div>
    </div>
</div>

<!--<div class="CustomerService">-->
<!--    <img class="img-ico" src="../pc/assets/img/customer-b.png" alt="">-->
<!--    <img class="img-ico-active" src="../pc/assets/img/customer-w.png" alt="">-->
<!--    <p>联系客服</p>-->
<!--    <div class="customerBox">-->
<!--        <div class="head">-->
<!--            <img src="../pc/assets/img/kf1.png" alt="">-->
<!--            <span class="customer-title"></span>-->
<!--        </div>-->
<!--        <div class="customerCode">-->
<!--            <img class="customer-qr" src="" alt="">-->
<!--        </div>-->
<!--        <div class="segmentation-line"></div>-->
<!--        <div class="customerWay">-->
<!--            <p class="wxText"><span class="s0">微信:</span> <span class="s1"></span></p>-->
<!--            <p class="qqText"><span class="s0">Q Q:</span> <span class="s1"></span></p>-->
<!--            <p class="telephone"><span class="s0">电话:</span> <span class="s1"></span></p>-->
<!--            <p class="mailbox"><span class="s0">邮箱:</span> <span class="s1"></span></p>-->
<!--        </div>-->
<!--        <p class="noCustomer">商家未设置客服</p>-->
<!--        <img class="customBg" src="../pc/assets/img/bg1.png" alt="">-->
<!--    </div>-->
<!--</div>-->

<div class="Bottom">

</div>
<div class="mask_body"></div>
<div class="coupon_pop">
    <input  id="copyInput" type="text">
    <div class="pop_top">
        <div class="pop_title">支付提醒</div>
        <img class="close_pop" src="../pc/assets/img/delete2.png" alt="">
    </div>
    <div class="pop_cont">
        <p class="p1">是否使用免费券支付?</p>
        <div class="back_block">
            <p class="p2">订单编号: <span class="orderId_pop"></span> <span class="copy_pop">复制</span> </p>
            <p class="p3">订单编号是查询和下载报告的唯一标识，请妥善保存。</p>
        </div>
    </div>
    <div class="pop_bottom">
        <div class="cancel_btn">取消</div>
        <div class="determine_btn">确定</div>
    </div>
</div>
</body>
<script src="../pc/assets/js/jquery.min.js"></script>
<script src="../pc/assets/js/bootstrap.min.js"></script>
<script src="../pc/assets/js/bootstrapValidator.min.js"></script>
<script src="../pc/assets/js/qrcode.min.js"></script>
<script src="../pc/assets/js/coco-message.js"></script>
<script src="../pc/assets/js/common.js?v=1.1"></script>
<script>
    var qrcode = new QRCode(document.getElementById("qrcode"), {
        width: 135,
        height: 135,
    });
    var source = ''

    // 先判断是不是微信端打开的
    let client = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
    if(client){
        source = 7
        if (/(micromessenger)/i.test(navigator.userAgent)) {
            source = 2
        }
    }else{
        source = 1
    }

    //  订单信息
    $(".order-title").text(getQueryVariable('title'))
    $(".order-author").text(getQueryVariable('author'))
    $(".order-wordNum").text(getQueryVariable('NumberWords') + '字符')
    $(".order-oid").text(getQueryVariable('order_sn'))
    $(".order-totalPrice").text(getQueryVariable('order_amount') + '元')

    //
    var pay_type = ''  //支付方式
    var typeAll = {
        wx: "wxScan",
        alipay: "alipayScan",
        scanCodeRich: "scanCodeRich",
        taobao: "taobao",
        redBook: 'redBook'
    }
    var noPayWay = false // 未配置支付
    var time = 600;
    var pay_id = '';
    var order_sn = '';
    var contentTypeIs = true;
    var timeout = null;
    var timeout2 = null;
    var Timeout = null;
    var isVerify = false;
    var pay_way_public = '';
    var closeMsg = cocoMessage.loading('正在获取价格...');

    if(getQueryVariable('order_sn')){
        order_sn = getQueryVariable('order_sn')
    }else{
        cocoMessage.error('订单丢失,请重新下单',2000);
        location.href = './index.html'
    }

    function tacitPay(goods_info, pay_way) {
        pay_way_public = pay_way
        var unitType = (goods_info.unit_count / 10000) + '万'
        if(goods_info.unit_count == 1000) {
            $(".order-unitPrice").text(goods_info.selling_price + '元/' + '千' + goods_info.unit_type)
        }else {
            $(".order-unitPrice").text(goods_info.selling_price + '元/' + unitType + goods_info.unit_type)
        }
        if(goods_info.unit_type == '字') {
            $('.UnitPrice').text(goods_info.selling_price+'元/'+ unitType + goods_info.unit_type+"（不满"+ unitType +"字按"+ unitType +"字计算）")
        }else {
            $('.UnitPrice').text(goods_info.selling_price+'元/每'+goods_info.unit_type)
        }
        pay_type = typeAll[pay_way.default]

        if(!pay_way.alipay && !pay_way.wx && !pay_way.scanCodeRich && !pay_way.taobao && !pay_way.redBook){
            noPayWay = true
        }

        if(pay_type == 'scanCodeRich') { // 扫码付
            $('.tipsBox').show()
            $(".code").show();
            $('.titlesRight').removeClass('payTypeClass')
            if(pay_way.taobao || pay_way.redBook) {// 扫码付有自定义订单的时候, 出现左侧选项
                $('#thirdparty').show()
                $('#scanCodeRich').show()
                $('#scanCodeRich').addClass('select')
            }
        }else{
            if(pay_way.alipay) $('#alipay').show()
            if(pay_way.wx) $('#wx').show()
            $('.clearfix2>.payType>div').removeClass('select')
            $('#' + pay_way.default).addClass('select')
            if(pay_way.taobao || pay_way.redBook) { // 第三方订单展示控制
                if(pay_type != 'taobao' && pay_type!='redBook') $('#thirdparty').show()

                if(pay_way.taobao) {
                    $('#TB').show()
                }
                if(pay_way.redBook) {
                    $('#XHS').show()
                }
            }
            // 默认支付方式为淘宝或小红书的时候, 说明没有其他支付方式了
            if(pay_type == 'taobao' || pay_type=='redBook') { // 淘宝或小红书订单(第三方订单)
                $(".code").hide();
                $(".tbPay").show();
                $(".tbPay").css('paddingLeft', 0)

                if(pay_type == 'taobao') { // 默认选中第三方支付方式
                    $('#TB').addClass('Select')
                }else {
                    $('#XHS').addClass('Select')
                }
                placeholder()
            }else {
                $(".code").show();
            }
        }

        if(noPayWay){
            // $(".noPayWay").show()
            // $("#orderAmount2").text(order_amount)
            // $(".pay_Box_y").hide();
            // $("#coupon").attr("placeholder", "请输入优惠券兑换码支付");
            // $(".no_pay_text").show();
            // $("#dateTime").text(getQueryVariable('created'))
            // $("#orderAmount2").text(getQueryVariable('order_amount'))
            // $("#orderIdText").text(getQueryVariable('order_sn'))
            // $(".orderId_pop").text(getQueryVariable('order_sn'))
            closeMsg()
        }else{
            if(pay_type == 'thirdparty'){
                closeMsg()
                return
            }
            payOrder(pay_type)
        }
    }

    function payOrder(payType,price) {
        $('.load').show()
        $(".mask").hide();
        if(pay_type == 'taobao' || pay_type == 'redBook') {
            $('.load').hide()
            closeMsg()
            // pay_id = order_sn
            contentTypeIs = true
            return;
        }
        if(pay_type == 'scanCodeRich'){
            $(".code").show()
            $(".orderAmount").text(price?price:getQueryVariable('order_amount'))
            qrcode.makeCode(getQueryVariable('pay_wap_url') + '/pay/waporder/' + (order_sn?order_sn:getQueryVariable('order_sn')) + '?source=' + source);
            $('.load').hide()
            time = 600
            $('.payTime').text(time)
            $('.order-oid').text(order_sn?order_sn:getQueryVariable('order_sn'))
            if(!order_sn){
                order_sn = getQueryVariable('order_sn')
            }
            contentTypeIs = true
            closeMsg()
            payStatus()
            countdown()
        }else{
            var formData = getFormData({
                order_sn: order_sn || getQueryVariable('order_sn'),
                pay_type,
                source
            })
            $.ajax({
                type: 'post',
                url: urls + '/api/client/pay/payOrder',
                processData: false,
                contentType: false,
                xhrFields: {
                    withCredentials: true
                },
                data: formData,
                success: function(data) {
                    if(data.code == 200) {
                        qrcode.makeCode(data.data.qrlink);
                        $('.orderAmount').text(data.data.payment_money || '0.00')
                        $('.load').hide()
                        time = 600
                        $('.payTime').text(time)
                        pay_id = data.data.pay_id
                        payStatus()
                        countdown()
                    }else if(data.code == 3001) {
                        cocoMessage.success('订单已支付', 2000)
                        window.location.href = "./query.html?oid=" + order_sn + '&editionType=' + getQueryVariable('editionType');
                    }else if(data.code == -1 && data.codeMsg == '不支持的该支付方式'){
                        cocoMessage.error(data.codeMsg, 2000);
                    }else {
                        cocoMessage.error(data.codeMsg, 2000);
                        $(".mask").show()
                        $('.load').hide()
                    }
                    contentTypeIs = true
                    closeMsg()
                },
                error: function(err) {
                    cocoMessage.error("请求失败!请检查网络", 2000);
                    contentTypeIs = true
                    closeMsg()
                }
            });
        }
    }

    // 支付方式切换
    $('.clearfix2>.payType>div').click(function () {
        if(pay_type) {
            if(!contentTypeIs) return
            if($(this).attr('data-type') != pay_type) {
                closeMsg = cocoMessage.loading('正在切换支付方式...');
                contentTypeIs = false
                $('.clearfix2>.payType>div').removeClass('select')
                $(this).addClass('select')
                pay_type = $(this).attr('data-type')
                if(pay_type == 'thirdparty'){
                    thirdpartyPayOrder()
                    return;
                }
                $(".tbPay").hide();
                $(".code").show();
                payOrder()
            }
        }
    })

    // 切换自定义订单提示
    function placeholder() {
        if($('.zdyType.Select').attr('id')=='XHS') {
            $('#tbTid').attr('placeholder' , '填写小红书订单编号(必填)')
        }else {
            $('#tbTid').attr('placeholder' , '填写淘宝订单编号(必填)')
        }
    }

    // 切换到第三方支付
    function thirdpartyPayOrder() {
        $(".code.pull-left").hide();
        contentTypeIs = true;
        $(".tbPay").show();

        if(pay_way_public.taobao) $('#TB').show()
        if(pay_way_public.redBook) $('#XHS').show()

        // 默认选中第三方支付方式
        if(pay_way_public.redBook) {
            $('#XHS').addClass('Select')
        }else {
            $('#TB').addClass('Select')
        }

        placeholder()
        clearTimeout(Timeout)
        time = 0
        closeMsg();
    }

    // 切换第三方支付方式
    $('.zdyType').click(function() {
        $('.zdyType').removeClass('Select')
        $(this).addClass('Select')
        placeholder()
        $(".errTip").text('')
    })

    // 第三方支付,确认按钮
    var TbPaying = false
    $(".tb-payOrder").click(function (){
        $(".errTip").hide();
        $(".tbPay").removeClass('errInput')
        if(TbPaying){
            return;
        }
        if(!$("#tbTid").val()) {
            $(".errTip").text($('#tbTid').attr('placeholder'))
            $(".tbPay").addClass('errInput')
            $(".errTip").show();
            return
        }
        var closeMsgTb = cocoMessage.loading("订单支付中", 2000);
        let formData = getFormData({
            order_sn: order_sn || getQueryVariable('order_sn'),
            pay_type: $('.zdyType.Select').attr('data-type'),
            tids: $("#tbTid").val() + ($('#tbTid-2').val()?(','+$('#tbTid-2').val()):''),
            source
        })
        TbPaying = true
        $.ajax({
            type: 'post',
            url: urls + '/api/client/pay/payOrder',
            processData: false,
            contentType: false,
            xhrFields: {
                withCredentials: true
            },
            data: formData,
            success: function (data) {
                TbPaying = false
                if(data.code == 200){

                }else{
                    if(data.code == 3001){
                        cocoMessage.success('订单已支付', 2000)
                        window.location.href = window.location.origin + "/query_order?oid=" + order_sn + '&editionType=' + getQueryVariable('editionType');
                        return
                    }
                    $(".tbPay").addClass('errInput')
                    $(".errTip").text(data.codeMsg)
                    $(".errTip").show();
                }
            },
            error: function (err) {
                TbPaying = false
                cocoMessage.error("请求失败!请检查网络", 2000);
                contentTypeIs = true
            },
            complete: function (){
                closeMsgTb()
            }
        })
    })

    // 支付倒计时
    function countdown(){
        clearTimeout(timeout2)
        timeout2 = setTimeout(function (){
            time --
            $('.payTime').text(time>0? time : 0)
            if(time > 0){
                countdown()
            }
        },1000)
    }

    // 订单轮询
    function payStatus() { // 轮询
        clearTimeout(Timeout);
        $.ajax({
            type: 'get',
            url: urls + '/apirs/order/is_pay?pay_id=' + order_sn,
            xhrFields: {
                withCredentials: true
            },
            success: function (res) {
                clearTimeout(Timeout);
                if (time <= 0) {
                    $(".mask").show();
                }
                if (!res.data) {
                    if (time > 0) {
                        Timeout = setTimeout(function () {
                            payStatus();
                        }, 1000);
                    }
                }else {
                    clearTimeout(Timeout);
                    window.location.href = "./query.html?oid=" + order_sn + '&editionType=' + getQueryVariable('editionType');
                }
            },
            error: function () {
                cocoMessage.error("请求失败!请检查网络", 2000);
            },
        });
    }

    // 刷新支付二维码
    $('.code .mask').click(function() { // 点击刷新
        $(".mask").hide();
        $('.load').show();
        payOrder()
    })

    // 下一步
    $('.next').click(function() {
        if(isVerify) return
        isVerify = true
        setTimeout(() => {
            isVerify = false
        },3000)
        var form_data = getFormData({
            pay_id: order_sn
        })
        $.ajax({
            type: 'post',
            url: urls + '/api/client/pay/verifyOrder',
            processData: false,
            contentType: false,
            xhrFields: {
                withCredentials: true
            },
            data: form_data,
            success: function (res) {
                if (res.code == 3001) {
                    cocoMessage.destroyAll();
                    cocoMessage.success('订单已支付', 2000)
                    window.location.href = "./query.html?oid=" + order_sn;
                }else {
                    cocoMessage.destroyAll();
                    cocoMessage.error("您的订单未支付", 2000);
                }
            },
            error: function () {
                cocoMessage.error("请求失败!请检查网络", 2000);
            },
            complete: function () {
                isVerify = false
            }
        });
    })

    //优惠券
    $("#coupon").on('input',function (){
        if($(this).val().length > 0){
            $(".use_now").addClass('can')
        }else{
            $(".use_now").removeClass('can')
        }
    })

    $("#coupon").on('change',function (){
        $(".errorTip").hide();
    })

    let canClick = true;
    $(".use_now").on('click',function() {
        if(!canClick){
            return
        }
        canClick = false
        closeMsg = cocoMessage.loading('正在兑换优惠券...');

        var formData = getFormData({
            order_sn: order_sn || getQueryVariable('order_sn'),
            code: $("#coupon").val()
        })

        $.ajax({
            type: 'post',
            url: urls + '/api/client/order/variation/order',
            data: formData,
            contentType: false,
            processData: false,
            xhrFields: {
                withCredentials: true
            },
            success: function (res) {
                canClick = true
                closeMsg()
                if (res.code == 200) {
                    order_sn = res.data.order_sn
                    $('.orderId_pop').text(res.data.order_sn)
                    $('.order-oid').text(res.data.order_sn)
                    console.log(res.data.order_sn)
                    if(Number(res.data.order_amount) == 0) {
                        $(".coupon_pop").show();
                        $(".mask_body").show();
                    }else{
                        if(noPayWay){
                            cocoMessage.error("此优惠券不满足免单条件！", 2000);
                            return;
                        }
                        payOrder('',res.data.order_amount)
                    }
                }else {
                    // cocoMessage.error(res.codeMsg, 2000);
                    $(".errorTip span").text(res.codeMsg)
                    $(".errorTip").show();
                    closeMsg()
                }
            },
            error: function () {
                cocoMessage.error("请求失败!请检查网络", 2000);
                contentTypeIs = true
                closeMsg()
                canClick = true
            },
        });

    })

    $(".copy_pop").on('click',function (){
        var text = $(".orderId_pop").text()
        $("#copyInput").val(text)
        $("#copyInput").select()
        try {
            var state = document.execCommand("copy");
        } catch (err) {
            var state = false;
        }
        if (state) {
            cocoMessage.success(1000, "复制成功", function() {
            });
        } else {
            cocoMessage.error(1000, "复制失败", function() {
            });
        }
    })

    function couponsPay() {
        var formData2 = getFormData({
            order_sn: order_sn,
            pay_type: 'coupons',
            source
        })
        $.ajax({
            type: 'post',
            url: urls + '/api/client/pay/payOrder',
            data: formData2,
            contentType: false,
            processData: false,
            xhrFields: {
                withCredentials: true
            },
            success: function (res) {
                if (res.code == 200) {

                }else if(res.code == 3001) {
                    cocoMessage.success('订单已支付', 2000)
                    window.location.href = "./query.html?oid=" + order_sn + '&editionType=' + getQueryVariable('editionType');
                }else {
                    cocoMessage.error(res.codeMsg, 2000);
                    closeMsg()
                }
            },
            error: function () {
                cocoMessage.error("请求失败!请检查网络", 2000);
                contentTypeIs = true
                closeMsg()
            },
        });
    }

    $(".close_pop").on('click',function (){
        $(".coupon_pop").hide();
        $(".mask_body").hide();
    })
    $(".cancel_btn").on('click',function (){
        $(".coupon_pop").hide();
        $(".mask_body").hide();
    })
    $(".determine_btn").on('click',function (){
        couponsPay()
    })
</script>
</html>